// 2014-04-18 Tyrghen
//---------------------------------------------
// Usage:
//  _locality call ioc_fnc_isRemote;
//---------------------------------------------
// Purpose:
// Determines whether the current call should be sent on the network knowing it's locality
// 
// Parameters:
// - The locality to check
//
// Returns:
// True if the call has to be forwarded on the network
//---------------------------------------------
// Objectif:
// 
//
// Paramètres:
// 
//
// Renvoie:
// 
//---------------------------------------------

//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "ioc\isRemote.sqf"
#include <core_macros.h>

TRACE_1("Start",_this);

private "_result";
_result = false;
if (isMultiplayer) then {
	if (IS_STRING(_this)) then {
		_result = switch (toLower(_this)) do {
			case '':			{ true };
			case "all":			{ true };
			case "tous":		{ true };
			case "server":		{ !isServer };
			case "serveur":		{ !isServer };
			case "player":		{ true };
			case "players":		{ true };
			case "joueur":		{ true };
			case "joueurs":		{ true };
			case "clients":		{ true };			
			case "headless":	{ ((call mso_core_fnc_hasHC) || {!isServer}) };
			case "hc":			{ ((call mso_core_fnc_hasHC) || {!isServer}) };
			default				{ false };
		};
	} else {
		if (IS_SCALAR(_this)) then {
			_result = switch (_this) do {
				case 0: { true };
				case 1: { !isServer };
				case 2: { true };
				case 3: { ((call mso_core_fnc_hasHC) || {!isServer}) };
				default { false };
			};
		} else {
			if (IS_OBJECT(_this)) then {
				_result = !(local _this);
			};	
		};
	};
} else {
	_result = false;
};
TRACE_1("End",_result);
_result;